package lambda;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class LambdaDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("范老师");
        list.add("刘桑");
        list.add("小泽老师");
        System.out.println(list);
//        Comparator<String> c = (o1,o2)->{
//                return o1.length()-o2.length();//反过来减就是降序
//            };


//        Comparator<String> c = (o1,o2)->
//             o1.length()-o2.length();//反过来减就是降序

        Collections.sort(list,(o1,o2)->o1.length()-o2.length());
        System.out.println(list);
        }

    }


